package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.AlbumStat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AlbumStatMapper extends BaseMapper<AlbumStat> {

    /**
     * 增加专辑购买次数
     * @param albumId
     * @param num
     * @return
     */
    @Update("UPDATE album_stat SET stat_num = stat_num + #{num} WHERE album_id = #{albumId} AND stat_type = '0403'")
    int updateAlbumStat(@Param("albumId") Long albumId,
                         @Param("num") Integer num);
}
